package edu.sctu.zhengsenwen.month201505.day20150512;

/**
* Created by user15 on 2015/5/13.
*/
public class TextChild extends ForExtends {

    public TextChild(Students[] a) {
        super(a);
    }

    @Override
      public Students[] getSysTem() {

        int j=0;
       for(int i=0;i<a.length;i++){

           if(a[i].getGrade() > 60){

               j++;
               System.out.println("姓名："+a[i].getName()+"\t"+"成绩："+a[i].getGrade()+"\t"+"年龄："+a[i].getAge()+"\t"
                       +"性别："+a[i].getSex() + "\t" +"学号："+a[i].getStudentID()+"\t"+"地址："+a[i].getAddress());
           }
       }

        System.out.println("成绩在60分以上的学生人数："+j);

        return a;
    }

    MyInterface interfaceone = new MyInterface() {
        @Override
        public int judgeAge(int age) {
            return age;
        }
    };

    public void WayOne(MyInterface interfaceone){

        int age1;

        age1  = interfaceone.judgeAge(18);

        int k=0;

        for(int i=0;i<a.length;i++) {

            if (a[i].getAge()>age1) {

                System.out.println("姓名：" + a[i].getName() + "\t" + "年龄：" + a[i].getAge() + "\t" + "成绩：" + a[i].getGrade() + "\t"
                        + "性别：" + a[i].getSex() + "\t" + "学号：" + a[i].getStudentID() + "\t" + "地址：" + a[i].getAddress());

                k++;
            }
            }

        System.out.println("年龄大于18岁的学生人数："+k);


        }
}

